package com.cloudbroker.openapi.manage.controller;

import static com.cloudbroker.bcs.platform.dav.common.util.RequestUtil.getSingleParameterMapForBody;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.cloudbroker.bcs.common.entity.HSBCPSBackVO;
import com.cloudbroker.bcs.common.util.VOUtil;
import com.cloudbroker.bcs.platform.dav.bizapi.service.business.favorite.result.FavoriteDetailResult;
import com.cloudbroker.bcs.platform.dav.bizapi.service.business.favorite.result.FavoritePageResult;
import com.cloudbroker.bcs.platform.dav.bizapi.service.business.favorite.vo.FavoriteAddForm;
import com.cloudbroker.bcs.platform.dav.bizapi.service.business.favorite.vo.FavoriteListForm;
import com.cloudbroker.bcs.platform.dav.bizapi.service.business.favorite.vo.FavoriteUpdateForm;
import com.cloudbroker.bcs.platform.dav.bizapi.service.business.favorite.vo.FavoriteViewForm;
import com.cloudbroker.bcs.platform.dav.bizapi.t2service.business.FavoriteT2BizService;
import com.cloudbroker.bcs.platform.dav.common.ext.annotation.SaveLog;


@Controller
public class FavoriteController {
    @Resource
    private FavoriteT2BizService favoriteT2;

	/**
     * 获取收藏夹列表信息
     * */
    @ResponseBody
    @RequestMapping("/func_favorite_list")
    @SaveLog(remark = "获取收藏夹列表信息")
    public FavoritePageResult funcFavoriteList(HttpServletRequest request , String jsonpcallback){
        FavoriteListForm form = getSingleParameterMapForBody(request , FavoriteListForm.class);
    	return VOUtil.setJsonpResult(favoriteT2.funcFavoriteList(form), jsonpcallback);
    }
    
    /**
     * 收藏详情查看
     * */
    @ResponseBody
    @RequestMapping("/func_favorite_detail")
    @SaveLog(remark = "收藏详情查看")
    public FavoriteDetailResult funcFavoriteDetail(HttpServletRequest request , String jsonpcallback){
        FavoriteViewForm form = getSingleParameterMapForBody(request , FavoriteViewForm.class);
    	return VOUtil.setJsonpResult(favoriteT2.funcFavoriteDetail(form), jsonpcallback);
    }
    
    /**
     * 收藏清空删除（待用）
     * */
    @ResponseBody
    @RequestMapping("/func_favorite_del")
    @SaveLog(remark = "收藏清空删除（待用）")
    public HSBCPSBackVO funcFavoriteDel(HttpServletRequest request , String jsonpcallback){
        FavoriteViewForm form = getSingleParameterMapForBody(request , FavoriteViewForm.class);
        return VOUtil.setJsonpResult(favoriteT2.funcFavoriteDel(form), jsonpcallback);
    }
    
    /**
     * 收藏新增
     * */
    @ResponseBody
    @RequestMapping("/func_favorite_save")
    @SaveLog(remark = "收藏新增")
    public FavoriteDetailResult funcFavoriteSave(HttpServletRequest request , String jsonpcallback){
        FavoriteAddForm form = getSingleParameterMapForBody(request , FavoriteAddForm.class);
    	return VOUtil.setJsonpResult(favoriteT2.funcFavoriteSave(form), jsonpcallback);
    }
    
    /**
     * 收藏修改
     * */
    @ResponseBody
    @RequestMapping("/func_favorite_update")
    @SaveLog(remark = "收藏修改")
    public HSBCPSBackVO funcFavoriteUpdate(HttpServletRequest request , String jsonpcallback){
        FavoriteUpdateForm form = getSingleParameterMapForBody(request , FavoriteUpdateForm.class);
    	return VOUtil.setJsonpResult(favoriteT2.funcFavoriteUpdate(form), jsonpcallback);
    }

}